3.7 \(\int \frac{\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\)

Optimal. Leaf size=271 \[ \frac{\sqrt{2} b c \left (\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}+1\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (b-\sqrt{b^2-4 a c}\right )+2 c}{\sqrt{2} \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{\sqrt{2} b c \left (1-\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}+b\right )+2 c}{\sqrt{2} \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a} \]

[Out]

(Sqrt[2]*b*c*(1 + (b^2 - 2*a*c)/(b*Sqrt[b^2 - 4*a*c]))*ArcTan[(2*c + (b - Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2
]*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]])])/(a^2*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]]) + (Sqrt
[2]*b*c*(1 - (b^2 - 2*a*c)/(b*Sqrt[b^2 - 4*a*c]))*ArcTan[(2*c + (b + Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqr
t[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]])])/(a^2*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]]) + (b*ArcTanh
[Cos[x]])/a^2 - Cot[x]/a

________________________________________________________________________________________

Rubi [A]  time = 0.895027, antiderivative size = 271, normalized size of antiderivative = 1., number of steps used = 12, number of rules used = 8, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.421, Rules used = {3256, 3770, 3767, 8, 3292, 2660, 618, 204} \[ \frac{\sqrt{2} b c \left (\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}+1\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (b-\sqrt{b^2-4 a c}\right )+2 c}{\sqrt{2} \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{-b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{\sqrt{2} b c \left (1-\frac{b^2-2 a c}{b \sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{x}{2}\right ) \left (\sqrt{b^2-4 a c}+b\right )+2 c}{\sqrt{2} \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt{b \sqrt{b^2-4 a c}-2 c (a+c)+b^2}}+\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a} \]

Antiderivative was successfully verified.

[In]

Int[Csc[x]^2/(a + b*Sin[x] + c*Sin[x]^2),x]

[Out]

(Sqrt[2]*b*c*(1 + (b^2 - 2*a*c)/(b*Sqrt[b^2 - 4*a*c]))*ArcTan[(2*c + (b - Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2
]*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]])])/(a^2*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]]) + (Sqrt
[2]*b*c*(1 - (b^2 - 2*a*c)/(b*Sqrt[b^2 - 4*a*c]))*ArcTan[(2*c + (b + Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqr
t[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]])])/(a^2*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]]) + (b*ArcTanh
[Cos[x]])/a^2 - Cot[x]/a

Rule 3256

Int[sin[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*sin[(d_.) + (e_.)*(x_)]^(n_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]
^(n2_.))^(p_), x_Symbol] :> Int[ExpandTrig[sin[d + e*x]^m*(a + b*sin[d + e*x]^n + c*sin[d + e*x]^(2*n))^p, x],
 x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[n2, 2*n] && NeQ[b^2 - 4*a*c, 0] && IntegersQ[m, n, p]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3292

Int[((A_) + (B_.)*sin[(d_.) + (e_.)*(x_)])/((a_.) + (b_.)*sin[(d_.) + (e_.)*(x_)] + (c_.)*sin[(d_.) + (e_.)*(x
_)]^2), x_Symbol] :> Module[{q = Rt[b^2 - 4*a*c, 2]}, Dist[B + (b*B - 2*A*c)/q, Int[1/(b + q + 2*c*Sin[d + e*x
]), x], x] + Dist[B - (b*B - 2*A*c)/q, Int[1/(b - q + 2*c*Sin[d + e*x]), x], x]] /; FreeQ[{a, b, c, d, e, A, B
}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 2660

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[(2*e)/d, Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx &=\int \left (-\frac{b \csc (x)}{a^2}+\frac{\csc ^2(x)}{a}+\frac{b^2 \left (1-\frac{a c}{b^2}\right )+b c \sin (x)}{a^2 \left (a+b \sin (x)+c \sin ^2(x)\right )}\right ) \, dx\\ &=\frac{\int \frac{b^2 \left (1-\frac{a c}{b^2}\right )+b c \sin (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx}{a^2}+\frac{\int \csc ^2(x) \, dx}{a}-\frac{b \int \csc (x) \, dx}{a^2}\\ &=\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\operatorname{Subst}(\int 1 \, dx,x,\cot (x))}{a}+\frac{\left (c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \int \frac{1}{b+\sqrt{b^2-4 a c}+2 c \sin (x)} \, dx}{a^2}+\frac{\left (c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \int \frac{1}{b-\sqrt{b^2-4 a c}+2 c \sin (x)} \, dx}{a^2}\\ &=\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a}+\frac{\left (2 c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b+\sqrt{b^2-4 a c}+4 c x+\left (b+\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{a^2}+\frac{\left (2 c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{b-\sqrt{b^2-4 a c}+4 c x+\left (b-\sqrt{b^2-4 a c}\right ) x^2} \, dx,x,\tan \left (\frac{x}{2}\right )\right )}{a^2}\\ &=\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a}-\frac{\left (4 c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{4 \left (4 c^2-\left (b+\sqrt{b^2-4 a c}\right )^2\right )-x^2} \, dx,x,4 c+2 \left (b+\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )\right )}{a^2}-\frac{\left (4 c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right )\right ) \operatorname{Subst}\left (\int \frac{1}{-8 \left (b^2-2 c (a+c)-b \sqrt{b^2-4 a c}\right )-x^2} \, dx,x,4 c+2 \left (b-\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )\right )}{a^2}\\ &=\frac{\sqrt{2} c \left (b+\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{2 c+\left (b-\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )}{\sqrt{2} \sqrt{b^2-2 c (a+c)-b \sqrt{b^2-4 a c}}}\right )}{a^2 \sqrt{b^2-2 c (a+c)-b \sqrt{b^2-4 a c}}}+\frac{\sqrt{2} c \left (b-\frac{b^2-2 a c}{\sqrt{b^2-4 a c}}\right ) \tan ^{-1}\left (\frac{2 c+\left (b+\sqrt{b^2-4 a c}\right ) \tan \left (\frac{x}{2}\right )}{\sqrt{2} \sqrt{b^2-2 c (a+c)+b \sqrt{b^2-4 a c}}}\right )}{a^2 \sqrt{b^2-2 c (a+c)+b \sqrt{b^2-4 a c}}}+\frac{b \tanh ^{-1}(\cos (x))}{a^2}-\frac{\cot (x)}{a}\\ \end{align*}

Mathematica [C]  time = 1.31576, size = 388, normalized size = 1.43 \[ \frac{\csc ^2(x) (-2 a-2 b \sin (x)+c \cos (2 x)-c) \left (-\frac{2 c \left (b \sqrt{4 a c-b^2}+2 i a c-i b^2\right ) \tan ^{-1}\left (\frac{2 c+\tan \left (\frac{x}{2}\right ) \left (b-i \sqrt{4 a c-b^2}\right )}{\sqrt{2} \sqrt{-i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}\right )}{\sqrt{2 a c-\frac{b^2}{2}} \sqrt{-i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}+\frac{2 i c \left (i b \sqrt{4 a c-b^2}+2 a c-b^2\right ) \tan ^{-1}\left (\frac{2 c+\tan \left (\frac{x}{2}\right ) \left (b+i \sqrt{4 a c-b^2}\right )}{\sqrt{2} \sqrt{i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}\right )}{\sqrt{2 a c-\frac{b^2}{2}} \sqrt{i b \sqrt{4 a c-b^2}-2 c (a+c)+b^2}}-a \tan \left (\frac{x}{2}\right )+a \cot \left (\frac{x}{2}\right )+2 b \log \left (\sin \left (\frac{x}{2}\right )\right )-2 b \log \left (\cos \left (\frac{x}{2}\right )\right )\right )}{4 a^2 \left (a \csc ^2(x)+b \csc (x)+c\right )} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[x]^2/(a + b*Sin[x] + c*Sin[x]^2),x]

[Out]

(Csc[x]^2*(-2*a - c + c*Cos[2*x] - 2*b*Sin[x])*((-2*c*((-I)*b^2 + (2*I)*a*c + b*Sqrt[-b^2 + 4*a*c])*ArcTan[(2*
c + (b - I*Sqrt[-b^2 + 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) - I*b*Sqrt[-b^2 + 4*a*c]])])/(Sqrt[-b
^2/2 + 2*a*c]*Sqrt[b^2 - 2*c*(a + c) - I*b*Sqrt[-b^2 + 4*a*c]]) + ((2*I)*c*(-b^2 + 2*a*c + I*b*Sqrt[-b^2 + 4*a
*c])*ArcTan[(2*c + (b + I*Sqrt[-b^2 + 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) + I*b*Sqrt[-b^2 + 4*a*
c]])])/(Sqrt[-b^2/2 + 2*a*c]*Sqrt[b^2 - 2*c*(a + c) + I*b*Sqrt[-b^2 + 4*a*c]]) + a*Cot[x/2] - 2*b*Log[Cos[x/2]
] + 2*b*Log[Sin[x/2]] - a*Tan[x/2]))/(4*a^2*(c + b*Csc[x] + a*Csc[x]^2))

________________________________________________________________________________________

Maple [B]  time = 0.187, size = 1087, normalized size = 4. \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(x)^2/(a+b*sin(x)+c*sin(x)^2),x)

[Out]

1/2/a*tan(1/2*x)+6/a/(4*a*c-b^2)/(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((-2*a*tan(1/2*x)+(-4*
a*c+b^2)^(1/2)-b)/(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*(-4*a*c+b^2)^(1/2)*b*c-2/a^2/(4*a*c-b^2)/(
4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((-2*a*tan(1/2*x)+(-4*a*c+b^2)^(1/2)-b)/(4*c*a-2*b^2+2*b
*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*(-4*a*c+b^2)^(1/2)*b^3+8/(4*a*c-b^2)/(4*c*a-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a
^2)^(1/2)*arctan((-2*a*tan(1/2*x)+(-4*a*c+b^2)^(1/2)-b)/(4*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^(1/2)+4*a^2)^(1/2))*b^2*c-2/a^2/(4*a*c-b^2)/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)*a
rctan((2*a*tan(1/2*x)+b+(-4*a*c+b^2)^(1/2))/(4*c*a-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))*b^4-1/2/a/tan(1/
2*x)-1/a^2*b*ln(tan(1/2*x))

________________________________________________________________________________________

Maxima [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2/(a+b*sin(x)+c*sin(x)^2),x, algorithm="maxima")

[Out]

Timed out

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2/(a+b*sin(x)+c*sin(x)^2),x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc ^{2}{\left (x \right )}}{a + b \sin{\left (x \right )} + c \sin ^{2}{\left (x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)**2/(a+b*sin(x)+c*sin(x)**2),x)

[Out]

Integral(csc(x)**2/(a + b*sin(x) + c*sin(x)**2), x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc \left (x\right )^{2}}{c \sin \left (x\right )^{2} + b \sin \left (x\right ) + a}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2/(a+b*sin(x)+c*sin(x)^2),x, algorithm="giac")

[Out]

integrate(csc(x)^2/(c*sin(x)^2 + b*sin(x) + a), x)